home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / richedit.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  29.2 KB  |  1,035 lines

  1. /*
  2.  *    RICHEDIT.H
  3.  *
  4.  *    Purpose:
  5.  *        RICHEDIT v2.0 public definitions.  Note that there is additional
  6.  *        functionality available for v2.0 that is not in the original
  7.  *        Windows 95 release.
  8.  *
  9.  *    Copyright (c) 1985-1996, Microsoft Corporation
  10.  */
  11.  
  12. #ifndef _RICHEDIT_
  13. #define    _RICHEDIT_
  14. #pragma option push -b
  15.  
  16.  
  17. #ifdef _WIN32
  18.  
  19. #include <pshpack4.h>
  20.  
  21. #elif !defined(RC_INVOKED)
  22. #pragma pack(4)
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif /* __cplusplus */
  28.  
  29. /* To mimic RichEdit 1.0 behavior for Unicode apps, simply set _RICHEDIT_VER to 0x0100 */
  30. #ifndef _RICHEDIT_VER
  31. #define _RICHEDIT_VER    0x0200
  32. #endif
  33.  
  34. /*
  35.  *    To make some structures which can be passed between 16 and 32 bit windows
  36.  *    almost compatible, padding is introduced to the 16 bit versions of the
  37.  *    structure.
  38.  */
  39. #ifdef _WIN32
  40. #    define    _WPAD    /##/
  41. #else
  42. #    define    _WPAD    WORD
  43. #endif
  44.  
  45. #define cchTextLimitDefault 32767
  46.  
  47. /* Richedit2.0 Window Class. */
  48.  
  49. #define RICHEDIT_CLASSA        "RichEdit20A"
  50. #define RICHEDIT_CLASS10A    "RICHEDIT"            // Richedit 1.0
  51.  
  52. #ifndef MACPORT
  53. #define RICHEDIT_CLASSW        L"RichEdit20W"
  54. #else    /*----------------------MACPORT */
  55. #define RICHEDIT_CLASSW        TEXT("RichEdit20W")    /* MACPORT change */
  56. #endif /* MACPORT  */
  57.  
  58. #if (_RICHEDIT_VER >= 0x0200 )
  59. #ifdef UNICODE
  60. #define RICHEDIT_CLASS        RICHEDIT_CLASSW
  61. #else
  62. #define RICHEDIT_CLASS        RICHEDIT_CLASSA
  63. #endif /* UNICODE */
  64. #else
  65. #define RICHEDIT_CLASS        RICHEDIT_CLASS10A
  66. #endif /* _RICHEDIT_VER >= 0x0200 */
  67.  
  68. /* RichEdit messages */
  69.  
  70. #ifndef WM_CONTEXTMENU
  71. #define WM_CONTEXTMENU            0x007B
  72. #endif
  73.  
  74. #ifndef WM_PRINTCLIENT
  75. #define WM_PRINTCLIENT            0x0318
  76. #endif
  77.  
  78. #ifndef EM_GETLIMITTEXT
  79. #define EM_GETLIMITTEXT            (WM_USER + 37)
  80. #endif
  81.  
  82. #ifndef EM_POSFROMCHAR    
  83. #define EM_POSFROMCHAR            (WM_USER + 38)
  84. #define EM_CHARFROMPOS            (WM_USER + 39)
  85. #endif
  86.  
  87. #ifndef EM_SCROLLCARET
  88. #define EM_SCROLLCARET            (WM_USER + 49)
  89. #endif
  90. #define EM_CANPASTE                (WM_USER + 50)
  91. #define EM_DISPLAYBAND            (WM_USER + 51)
  92. #define EM_EXGETSEL                (WM_USER + 52)
  93. #define EM_EXLIMITTEXT            (WM_USER + 53)
  94. #define EM_EXLINEFROMCHAR        (WM_USER + 54)
  95. #define EM_EXSETSEL                (WM_USER + 55)
  96. #define EM_FINDTEXT                (WM_USER + 56)
  97. #define EM_FORMATRANGE            (WM_USER + 57)
  98. #define EM_GETCHARFORMAT        (WM_USER + 58)
  99. #define EM_GETEVENTMASK            (WM_USER + 59)
  100. #define EM_GETOLEINTERFACE        (WM_USER + 60)
  101. #define EM_GETPARAFORMAT        (WM_USER + 61)
  102. #define EM_GETSELTEXT            (WM_USER + 62)
  103. #define EM_HIDESELECTION        (WM_USER + 63)
  104. #define EM_PASTESPECIAL            (WM_USER + 64)
  105. #define EM_REQUESTRESIZE        (WM_USER + 65)
  106. #define EM_SELECTIONTYPE        (WM_USER + 66)
  107. #define EM_SETBKGNDCOLOR        (WM_USER + 67)
  108. #define EM_SETCHARFORMAT        (WM_USER + 68)
  109. #define EM_SETEVENTMASK            (WM_USER + 69)
  110. #define EM_SETOLECALLBACK        (WM_USER + 70)
  111. #define EM_SETPARAFORMAT        (WM_USER + 71)
  112. #define EM_SETTARGETDEVICE        (WM_USER + 72)
  113. #define EM_STREAMIN                (WM_USER + 73)
  114. #define EM_STREAMOUT            (WM_USER + 74)
  115. #define EM_GETTEXTRANGE            (WM_USER + 75)
  116. #define EM_FINDWORDBREAK        (WM_USER + 76)
  117. #define EM_SETOPTIONS            (WM_USER + 77)
  118. #define EM_GETOPTIONS            (WM_USER + 78)
  119. #define EM_FINDTEXTEX            (WM_USER + 79)
  120. #ifdef _WIN32
  121. #define EM_GETWORDBREAKPROCEX    (WM_USER + 80)
  122. #define EM_SETWORDBREAKPROCEX    (WM_USER + 81)
  123. #endif
  124.  
  125. /* Richedit v2.0 messages */
  126. #define    EM_SETUNDOLIMIT            (WM_USER + 82)
  127. #define EM_REDO                    (WM_USER + 84)
  128. #define EM_CANREDO                (WM_USER + 85)
  129. #define EM_GETUNDONAME            (WM_USER + 86)
  130. #define EM_GETREDONAME            (WM_USER + 87)
  131. #define EM_STOPGROUPTYPING        (WM_USER + 88)
  132.  
  133. #define EM_SETTEXTMODE            (WM_USER + 89)
  134. #define EM_GETTEXTMODE            (WM_USER + 90)
  135.  
  136. /* enum for use with EM_GET/SETTEXTMODE */
  137. typedef enum tagTextMode
  138. {
  139.     TM_PLAINTEXT            = 1,
  140.     TM_RICHTEXT                = 2,    /* default behavior */
  141.     TM_SINGLELEVELUNDO        = 4,
  142.     TM_MULTILEVELUNDO        = 8,    /* default behavior */
  143.     TM_SINGLECODEPAGE        = 16,
  144.     TM_MULTICODEPAGE        = 32    /* default behavior */
  145. } TEXTMODE;
  146.  
  147. #define EM_AUTOURLDETECT        (WM_USER + 91)
  148. #define EM_GETAUTOURLDETECT        (WM_USER + 92)
  149. #define EM_SETPALETTE            (WM_USER + 93)
  150. #define EM_GETTEXTEX            (WM_USER + 94)
  151. #define EM_GETTEXTLENGTHEX        (WM_USER + 95)
  152.  
  153. /* Far East specific messages */
  154. #define EM_SETPUNCTUATION        (WM_USER + 100)
  155. #define EM_GETPUNCTUATION        (WM_USER + 101)
  156. #define EM_SETWORDWRAPMODE        (WM_USER + 102)
  157. #define EM_GETWORDWRAPMODE        (WM_USER + 103)
  158. #define EM_SETIMECOLOR            (WM_USER + 104)
  159. #define EM_GETIMECOLOR            (WM_USER + 105)
  160. #define EM_SETIMEOPTIONS        (WM_USER + 106)
  161. #define EM_GETIMEOPTIONS        (WM_USER + 107)
  162. #define EM_CONVPOSITION         (WM_USER + 108)
  163.  
  164. #define EM_SETLANGOPTIONS        (WM_USER + 120)
  165. #define EM_GETLANGOPTIONS        (WM_USER + 121)
  166. #define EM_GETIMECOMPMODE        (WM_USER + 122)
  167.  
  168. /* Options for EM_SETLANGOPTIONS and EM_GETLANGOPTIONS */
  169. #define IMF_AUTOKEYBOARD        0x0001
  170. #define IMF_AUTOFONT            0x0002
  171. #define IMF_IMECANCELCOMPLETE    0x0004    // high completes the comp string when aborting, low cancels.
  172. #define IMF_IMEALWAYSSENDNOTIFY 0x0008
  173.  
  174. /* Values for EM_GETIMECOMPMODE */
  175. #define ICM_NOTOPEN                0x0000
  176. #define ICM_LEVEL3                0x0001
  177. #define ICM_LEVEL2                0x0002
  178. #define ICM_LEVEL2_5            0x0003
  179. #define ICM_LEVEL2_SUI            0x0004
  180.  
  181. /* New notifications */
  182.  
  183. #define EN_MSGFILTER            0x0700
  184. #define EN_REQUESTRESIZE        0x0701
  185. #define EN_SELCHANGE            0x0702
  186. #define EN_DROPFILES            0x0703
  187. #define EN_PROTECTED            0x0704
  188. #define EN_CORRECTTEXT            0x0705            /* PenWin specific */
  189. #define EN_STOPNOUNDO            0x0706
  190. #define EN_IMECHANGE            0x0707            /* Far East specific */
  191. #define EN_SAVECLIPBOARD        0x0708
  192. #define EN_OLEOPFAILED            0x0709
  193. #define EN_OBJECTPOSITIONS        0x070a
  194. #define EN_LINK                    0x070b
  195. #define EN_DRAGDROPDONE            0x070c
  196.  
  197. /* Event notification masks */
  198.  
  199. #define ENM_NONE                0x00000000
  200. #define ENM_CHANGE                0x00000001
  201. #define ENM_UPDATE                0x00000002
  202. #define ENM_SCROLL                0x00000004
  203. #define ENM_KEYEVENTS            0x00010000
  204. #define ENM_MOUSEEVENTS            0x00020000
  205. #define ENM_REQUESTRESIZE        0x00040000
  206. #define ENM_SELCHANGE            0x00080000
  207. #define ENM_DROPFILES            0x00100000
  208. #define ENM_PROTECTED            0x00200000
  209. #define ENM_CORRECTTEXT            0x00400000        /* PenWin specific */
  210. #define ENM_SCROLLEVENTS        0x00000008
  211. #define ENM_DRAGDROPDONE        0x00000010
  212.  
  213. /* Far East specific notification mask */
  214. #define ENM_IMECHANGE            0x00800000        /* unused by RE2.0 */
  215. #define ENM_LANGCHANGE            0x01000000
  216. #define ENM_OBJECTPOSITIONS        0x02000000
  217. #define ENM_LINK                0x04000000
  218.  
  219. /* New edit control styles */
  220.  
  221. #define ES_SAVESEL                0x00008000
  222. #define ES_SUNKEN                0x00004000
  223. #define ES_DISABLENOSCROLL        0x00002000
  224. /* same as WS_MAXIMIZE, but that doesn't make sense so we re-use the value */
  225. #define ES_SELECTIONBAR            0x01000000
  226. /* same as ES_UPPERCASE, but re-used to completely disable OLE drag'n'drop */
  227. #define ES_NOOLEDRAGDROP        0x00000008
  228.  
  229. /* New edit control extended style */
  230. #ifdef    _WIN32
  231. #define ES_EX_NOCALLOLEINIT        0x01000000
  232. #endif    
  233.  
  234. /* These flags are used in FE Windows */
  235. #define ES_VERTICAL                0x00400000
  236. #define    ES_NOIME                0x00080000
  237. #define ES_SELFIME                0x00040000
  238.  
  239. /* Edit control options */
  240. #define ECO_AUTOWORDSELECTION    0x00000001
  241. #define ECO_AUTOVSCROLL            0x00000040
  242. #define ECO_AUTOHSCROLL            0x00000080
  243. #define ECO_NOHIDESEL            0x00000100
  244. #define ECO_READONLY            0x00000800
  245. #define ECO_WANTRETURN            0x00001000
  246. #define ECO_SAVESEL                0x00008000
  247. #define ECO_SELECTIONBAR        0x01000000
  248. #define ECO_VERTICAL            0x00400000        /* FE specific */
  249.  
  250.  
  251. /* ECO operations */
  252. #define ECOOP_SET                0x0001
  253. #define ECOOP_OR                0x0002
  254. #define ECOOP_AND                0x0003
  255. #define ECOOP_XOR                0x0004
  256.  
  257. /* new word break function actions */
  258. #define WB_CLASSIFY            3
  259. #define WB_MOVEWORDLEFT        4
  260. #define WB_MOVEWORDRIGHT    5
  261. #define WB_LEFTBREAK        6
  262. #define WB_RIGHTBREAK        7
  263.  
  264. /* Far East specific flags */
  265. #define WB_MOVEWORDPREV        4
  266. #define WB_MOVEWORDNEXT        5
  267. #define WB_PREVBREAK        6
  268. #define WB_NEXTBREAK        7
  269.  
  270. #define PC_FOLLOWING        1
  271. #define    PC_LEADING            2
  272. #define    PC_OVERFLOW            3
  273. #define    PC_DELIMITER        4
  274. #define WBF_WORDWRAP        0x010
  275. #define WBF_WORDBREAK        0x020
  276. #define    WBF_OVERFLOW        0x040    
  277. #define WBF_LEVEL1            0x080
  278. #define    WBF_LEVEL2            0x100
  279. #define    WBF_CUSTOM            0x200
  280.  
  281. /* Far East specific flags */
  282. #define IMF_FORCENONE           0x0001
  283. #define IMF_FORCEENABLE         0x0002
  284. #define IMF_FORCEDISABLE        0x0004
  285. #define IMF_CLOSESTATUSWINDOW   0x0008
  286. #define IMF_VERTICAL            0x0020
  287. #define IMF_FORCEACTIVE         0x0040
  288. #define IMF_FORCEINACTIVE       0x0080
  289. #define IMF_FORCEREMEMBER       0x0100
  290. #define IMF_MULTIPLEEDIT        0x0400
  291.  
  292. /* Word break flags (used with WB_CLASSIFY) */
  293. #define WBF_CLASS            ((BYTE) 0x0F)
  294. #define WBF_ISWHITE            ((BYTE) 0x10)
  295. #define WBF_BREAKLINE        ((BYTE) 0x20)
  296. #define WBF_BREAKAFTER        ((BYTE) 0x40)
  297.  
  298.  
  299. /* new data types */
  300.  
  301. #ifdef _WIN32
  302. /* extended edit word break proc (character set aware) */
  303. typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action);
  304. #endif
  305.  
  306. /* all character format measurements are in twips */
  307. typedef struct _charformat
  308. {
  309.     UINT        cbSize;
  310.     _WPAD        _wPad1;
  311.     DWORD        dwMask;
  312.     DWORD        dwEffects;
  313.     LONG        yHeight;
  314.     LONG        yOffset;
  315.     COLORREF    crTextColor;
  316.     BYTE        bCharSet;
  317.     BYTE        bPitchAndFamily;
  318.     char        szFaceName[LF_FACESIZE];
  319.     _WPAD        _wPad2;
  320. } CHARFORMATA;
  321.  
  322. typedef struct _charformatw
  323. {
  324.     UINT        cbSize;
  325.     _WPAD        _wPad1;
  326.     DWORD        dwMask;
  327.     DWORD        dwEffects;
  328.     LONG        yHeight;
  329.     LONG        yOffset;
  330.     COLORREF    crTextColor;
  331.     BYTE        bCharSet;
  332.     BYTE        bPitchAndFamily;
  333.     WCHAR        szFaceName[LF_FACESIZE];
  334.     _WPAD        _wPad2;
  335. } CHARFORMATW;
  336.  
  337. #if (_RICHEDIT_VER >= 0x0200)
  338. #ifdef UNICODE
  339. #define CHARFORMAT CHARFORMATW
  340. #else
  341. #define CHARFORMAT CHARFORMATA
  342. #endif /* UNICODE */
  343. #else
  344. #define CHARFORMAT CHARFORMATA
  345. #endif /* _RICHEDIT_VER >= 0x0200 */
  346.  
  347. /* CHARFORMAT masks */
  348. #define CFM_BOLD        0x00000001
  349. #define CFM_ITALIC        0x00000002
  350. #define CFM_UNDERLINE    0x00000004
  351. #define CFM_STRIKEOUT    0x00000008
  352. #define CFM_PROTECTED    0x00000010
  353. #define CFM_LINK        0x00000020        /* Exchange hyperlink extension */
  354. #define CFM_SIZE        0x80000000
  355. #define CFM_COLOR        0x40000000
  356. #define CFM_FACE        0x20000000
  357. #define CFM_OFFSET        0x10000000
  358. #define CFM_CHARSET        0x08000000
  359.  
  360. /* CHARFORMAT effects */
  361. #define CFE_BOLD        0x0001
  362. #define CFE_ITALIC        0x0002
  363. #define CFE_UNDERLINE    0x0004
  364. #define CFE_STRIKEOUT    0x0008
  365. #define CFE_PROTECTED    0x0010
  366. #define CFE_LINK        0x0020
  367. #define CFE_AUTOCOLOR    0x40000000        /* NOTE: this corresponds to */
  368.                                         /* CFM_COLOR, which controls it */
  369. #define yHeightCharPtsMost 1638
  370.  
  371. /* EM_SETCHARFORMAT wParam masks */
  372. #define SCF_SELECTION    0x0001
  373. #define SCF_WORD        0x0002
  374. #define SCF_DEFAULT        0x0000        // set the default charformat or paraformat
  375. #define SCF_ALL            0x0004        // not valid with SCF_SELECTION or SCF_WORD
  376. #define SCF_USEUIRULES    0x0008        // modifier for SCF_SELECTION; says that
  377.                                     // the format came from a toolbar, etc. and
  378.                                     // therefore UI formatting rules should be
  379.                                     // used instead of strictly formatting the
  380.                                     // selection.
  381.  
  382.  
  383. typedef struct _charrange
  384. {
  385.     LONG    cpMin;
  386.     LONG    cpMax;
  387. } CHARRANGE;
  388.  
  389. typedef struct _textrange
  390. {
  391.     CHARRANGE chrg;
  392.     LPSTR lpstrText;    /* allocated by caller, zero terminated by RichEdit */
  393. } TEXTRANGEA;
  394.  
  395. typedef struct _textrangew
  396. {
  397.     CHARRANGE chrg;
  398.     LPWSTR lpstrText;    /* allocated by caller, zero terminated by RichEdit */
  399. } TEXTRANGEW;
  400.  
  401. #if (_RICHEDIT_VER >= 0x0200)
  402. #ifdef UNICODE
  403. #define TEXTRANGE     TEXTRANGEW
  404. #else
  405. #define TEXTRANGE    TEXTRANGEA
  406. #endif /* UNICODE */
  407. #else
  408. #define TEXTRANGE    TEXTRANGEA
  409. #endif /* _RICHEDIT_VER >= 0x0200 */
  410.  
  411.  
  412. typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
  413.  
  414. typedef struct _editstream
  415. {
  416.     DWORD dwCookie;        /* user value passed to callback as first parameter */
  417.     DWORD dwError;        /* last error */
  418.     EDITSTREAMCALLBACK pfnCallback;
  419. } EDITSTREAM;
  420.  
  421. /* stream formats */
  422.  
  423. #define SF_TEXT            0x0001
  424. #define SF_RTF            0x0002
  425. #define SF_RTFNOOBJS    0x0003        /* outbound only */
  426. #define SF_TEXTIZED        0x0004        /* outbound only */
  427. #define SF_UNICODE        0x0010        /* Unicode file of some kind */
  428.  
  429. /* Flag telling stream operations to operate on the selection only */
  430. /* EM_STREAMIN will replace the current selection */
  431. /* EM_STREAMOUT will stream out the current selection */
  432. #define SFF_SELECTION    0x8000
  433.  
  434. /* Flag telling stream operations to operate on the common RTF keyword only */
  435. /* EM_STREAMIN will accept the only common RTF keyword */
  436. /* EM_STREAMOUT will stream out the only common RTF keyword */
  437. #define SFF_PLAINRTF    0x4000
  438.  
  439. typedef struct _findtext
  440. {
  441.     CHARRANGE chrg;
  442.     LPSTR lpstrText;
  443. } FINDTEXTA;
  444.  
  445. typedef struct _findtextw
  446. {
  447.     CHARRANGE chrg;
  448.     LPWSTR lpstrText;
  449. } FINDTEXTW;
  450.  
  451. #if (_RICHEDIT_VER >= 0x0200)
  452. #ifdef UNICODE
  453. #define FINDTEXT    FINDTEXTW
  454. #else
  455. #define FINDTEXT    FINDTEXTA
  456. #endif /* UNICODE */
  457. #else
  458. #define FINDTEXT    FINDTEXTA
  459. #endif /* _RICHEDIT_VER >= 0x0200 */
  460.  
  461. typedef struct _findtextexa
  462. {
  463.     CHARRANGE chrg;
  464.     LPSTR lpstrText;
  465.     CHARRANGE chrgText;
  466. } FINDTEXTEXA;
  467.  
  468. typedef struct _findtextexw
  469. {
  470.     CHARRANGE chrg;
  471.     LPWSTR lpstrText;
  472.     CHARRANGE chrgText;
  473. } FINDTEXTEXW;
  474.  
  475. #if (_RICHEDIT_VER >= 0x0200)
  476. #ifdef UNICODE
  477. #define FINDTEXTEX    FINDTEXTEXW
  478. #else
  479. #define FINDTEXTEX    FINDTEXTEXA
  480. #endif /* UNICODE */
  481. #else
  482. #define FINDTEXTEX    FINDTEXTEXA
  483. #endif /* _RICHEDIT_VER >= 0x0200 */
  484.  
  485.  
  486. typedef struct _formatrange
  487. {
  488.     HDC hdc;
  489.     HDC hdcTarget;
  490.     RECT rc;
  491.     RECT rcPage;
  492.     CHARRANGE chrg;
  493. } FORMATRANGE;
  494.  
  495. /* all paragraph measurements are in twips */
  496.  
  497. #define MAX_TAB_STOPS 32
  498. #define lDefaultTab 720
  499.  
  500. typedef struct _paraformat
  501. {
  502.     UINT    cbSize;
  503.     _WPAD    _wPad1;
  504.     DWORD    dwMask;
  505.     WORD    wNumbering;
  506.     WORD    wReserved;
  507.     LONG    dxStartIndent;
  508.     LONG    dxRightIndent;
  509.     LONG    dxOffset;
  510.     WORD    wAlignment;
  511.     SHORT    cTabCount;
  512.     LONG    rgxTabs[MAX_TAB_STOPS];
  513. } PARAFORMAT;
  514.  
  515. /* PARAFORMAT mask values */
  516. #define PFM_STARTINDENT            0x00000001
  517. #define PFM_RIGHTINDENT            0x00000002
  518. #define PFM_OFFSET                0x00000004
  519. #define PFM_ALIGNMENT            0x00000008
  520. #define PFM_TABSTOPS            0x00000010
  521. #define PFM_NUMBERING            0x00000020
  522. #define PFM_OFFSETINDENT        0x80000000
  523.  
  524. /* PARAFORMAT numbering options */
  525. #define PFN_BULLET        0x0001
  526.  
  527. /* PARAFORMAT alignment options */
  528. #define PFA_LEFT    0x0001
  529. #define PFA_RIGHT    0x0002
  530. #define PFA_CENTER    0x0003
  531.  
  532. /* CHARFORMAT2 and PARAFORMAT2 structures */
  533.  
  534. #ifdef __cplusplus
  535.  
  536. struct CHARFORMAT2W : _charformatw
  537. {
  538.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  539.     SHORT        sSpacing;            /* Amount to space between letters    */
  540.     COLORREF    crBackColor;        /* Background color                    */
  541.     LCID        lcid;                /* Locale ID                        */
  542.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  543.     SHORT        sStyle;                /* Style handle                        */
  544.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  545.     BYTE        bUnderlineType;        /* Underline type                    */
  546.     BYTE        bAnimation;            /* Animated text like marching ants */
  547.     BYTE        bRevAuthor;            /* Revision author index            */
  548. };
  549.  
  550. struct CHARFORMAT2A : _charformat
  551. {
  552.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  553.     SHORT        sSpacing;            /* Amount to space between letters    */
  554.     COLORREF    crBackColor;        /* Background color                    */
  555.     LCID        lcid;                /* Locale ID                        */
  556.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  557.     SHORT        sStyle;                /* Style handle                        */
  558.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  559.     BYTE        bUnderlineType;        /* Underline type                    */
  560.     BYTE        bAnimation;            /* Animated text like marching ants    */
  561.     BYTE        bRevAuthor;            /* Revision author index            */
  562. };
  563.  
  564. #else    /* regular C-style  */
  565.  
  566. typedef struct _charformat2w
  567. {
  568.     UINT        cbSize;
  569.     _WPAD        _wPad1;
  570.     DWORD        dwMask;
  571.     DWORD        dwEffects;
  572.     LONG        yHeight;
  573.     LONG        yOffset;            /* > 0 for superscript, < 0 for subscript */
  574.     COLORREF    crTextColor;
  575.     BYTE        bCharSet;
  576.     BYTE        bPitchAndFamily;
  577.     WCHAR        szFaceName[LF_FACESIZE];
  578.     _WPAD        _wPad2;
  579.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  580.     SHORT        sSpacing;            /* Amount to space between letters    */
  581.     COLORREF    crBackColor;        /* Background color                    */
  582.     LCID        lcid;                /* Locale ID                        */
  583.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  584.     SHORT        sStyle;                /* Style handle                        */
  585.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  586.     BYTE        bUnderlineType;        /* Underline type                    */
  587.     BYTE        bAnimation;            /* Animated text like marching ants    */
  588.     BYTE        bRevAuthor;            /* Revision author index            */
  589.     BYTE        bReserved1;
  590. } CHARFORMAT2W;
  591.  
  592. typedef struct _charformat2a
  593. {
  594.     UINT        cbSize;
  595.     _WPAD        _wPad1;
  596.     DWORD        dwMask;
  597.     DWORD        dwEffects;
  598.     LONG        yHeight;
  599.     LONG        yOffset;            /* > 0 for superscript, < 0 for subscript */
  600.     COLORREF    crTextColor;
  601.     BYTE        bCharSet;
  602.     BYTE        bPitchAndFamily;
  603.     char        szFaceName[LF_FACESIZE];
  604.     _WPAD        _wPad2;
  605.     WORD        wWeight;            /* Font weight (LOGFONT value)        */
  606.     SHORT        sSpacing;            /* Amount to space between letters    */
  607.     COLORREF    crBackColor;        /* Background color                    */
  608.     LCID        lcid;                /* Locale ID                        */
  609.     DWORD        dwReserved;            /* Reserved. Must be 0                */
  610.     SHORT        sStyle;                /* Style handle                        */
  611.     WORD        wKerning;            /* Twip size above which to kern char pair*/
  612.     BYTE        bUnderlineType;        /* Underline type                    */
  613.     BYTE        bAnimation;            /* Animated text like marching ants    */
  614.     BYTE        bRevAuthor;            /* Revision author index            */
  615. } CHARFORMAT2A;
  616.  
  617. #endif /* C++ */
  618.  
  619. #ifdef UNICODE
  620. #define CHARFORMAT2    CHARFORMAT2W
  621. #else
  622. #define CHARFORMAT2 CHARFORMAT2A
  623. #endif
  624.  
  625. #define CHARFORMATDELTA        (sizeof(CHARFORMAT2) - sizeof(CHARFORMAT))
  626.  
  627.  
  628. /* CHARFORMAT and PARAFORMAT "ALL" masks
  629.    CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor*/
  630.  
  631. #define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
  632.                      CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
  633. #define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)
  634.  
  635. #define    PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET    | \
  636.                  PFM_ALIGNMENT   | PFM_TABSTOPS    | PFM_NUMBERING | \
  637.                  PFM_OFFSETINDENT)
  638.  
  639. /* New masks and effects -- a parenthesized asterisk indicates that
  640.    the data is stored by RichEdit2.0, but not displayed */
  641.  
  642. #define CFM_SMALLCAPS        0x0040            /* (*)    */
  643. #define    CFM_ALLCAPS            0x0080            /* (*)    */
  644. #define    CFM_HIDDEN            0x0100            /* (*)    */
  645. #define    CFM_OUTLINE            0x0200            /* (*)    */
  646. #define    CFM_SHADOW            0x0400            /* (*)    */
  647. #define    CFM_EMBOSS            0x0800            /* (*)    */
  648. #define    CFM_IMPRINT            0x1000            /* (*)    */
  649. #define CFM_DISABLED        0x2000
  650. #define    CFM_REVISED            0x4000
  651.  
  652. #define CFM_BACKCOLOR        0x04000000
  653. #define CFM_LCID            0x02000000
  654. #define    CFM_UNDERLINETYPE    0x00800000        /* (*)    */
  655. #define    CFM_WEIGHT            0x00400000
  656. #define CFM_SPACING            0x00200000        /* (*)    */
  657. #define CFM_KERNING            0x00100000        /* (*)    */
  658. #define CFM_STYLE            0x00080000        /* (*)    */
  659. #define CFM_ANIMATION        0x00040000        /* (*)    */
  660. #define CFM_REVAUTHOR        0x00008000
  661.  
  662. #define CFE_SUBSCRIPT        0x00010000        /* Superscript and subscript are */
  663. #define CFE_SUPERSCRIPT        0x00020000        /*  mutually exclusive             */
  664.  
  665. #define CFM_SUBSCRIPT        CFE_SUBSCRIPT | CFE_SUPERSCRIPT
  666. #define CFM_SUPERSCRIPT        CFM_SUBSCRIPT
  667.  
  668. #define    CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \
  669.                     | CFM_HIDDEN  | CFM_OUTLINE | CFM_SHADOW | CFM_EMBOSS \
  670.                     | CFM_IMPRINT | CFM_DISABLED | CFM_REVISED \
  671.                     | CFM_SUBSCRIPT | CFM_SUPERSCRIPT | CFM_BACKCOLOR)
  672.  
  673. #define CFM_ALL2     (CFM_ALL | CFM_EFFECTS2 | CFM_BACKCOLOR | CFM_LCID \
  674.                     | CFM_UNDERLINETYPE | CFM_WEIGHT | CFM_REVAUTHOR \
  675.                     | CFM_SPACING | CFM_KERNING | CFM_STYLE | CFM_ANIMATION)
  676.  
  677. #define    CFE_SMALLCAPS        CFM_SMALLCAPS
  678. #define    CFE_ALLCAPS            CFM_ALLCAPS
  679. #define    CFE_HIDDEN            CFM_HIDDEN
  680. #define    CFE_OUTLINE            CFM_OUTLINE
  681. #define    CFE_SHADOW            CFM_SHADOW
  682. #define    CFE_EMBOSS            CFM_EMBOSS
  683. #define    CFE_IMPRINT            CFM_IMPRINT
  684. #define    CFE_DISABLED        CFM_DISABLED
  685. #define    CFE_REVISED            CFM_REVISED
  686.  
  687. /* NOTE: CFE_AUTOCOLOR and CFE_AUTOBACKCOLOR correspond to CFM_COLOR and
  688.    CFM_BACKCOLOR, respectively, which control them */
  689. #define CFE_AUTOBACKCOLOR    CFM_BACKCOLOR
  690.  
  691. /* Underline types */
  692. #define CFU_CF1UNDERLINE    0xFF    /* map charformat's bit underline to CF2.*/
  693. #define CFU_INVERT            0xFE    /* For IME composition fake a selection.*/    
  694. #define    CFU_UNDERLINEDOTTED    0x4        /* (*) displayed as ordinary underline    */
  695. #define    CFU_UNDERLINEDOUBLE    0x3        /* (*) displayed as ordinary underline    */
  696. #define CFU_UNDERLINEWORD    0x2        /* (*) displayed as ordinary underline    */
  697. #define CFU_UNDERLINE        0x1
  698. #define CFU_UNDERLINENONE    0
  699.  
  700. #ifdef __cplusplus
  701. struct PARAFORMAT2 : _paraformat
  702. {
  703.     LONG    dySpaceBefore;            /* Vertical spacing before para            */
  704.     LONG    dySpaceAfter;            /* Vertical spacing after para            */    
  705.     LONG    dyLineSpacing;            /* Line spacing depending on Rule        */
  706.     SHORT    sStyle;                    /* Style handle                            */
  707.     BYTE    bLineSpacingRule;        /* Rule for line spacing (see tom.doc)    */
  708.     BYTE    bCRC;                    /* Reserved for CRC for rapid searching    */
  709.     WORD    wShadingWeight;            /* Shading in hundredths of a per cent    */
  710.     WORD    wShadingStyle;            /* Nibble 0: style, 1: cfpat, 2: cbpat    */
  711.     WORD    wNumberingStart;        /* Starting value for numbering            */
  712.     WORD    wNumberingStyle;        /* Alignment, roman/arabic, (), ), ., etc.*/
  713.     WORD    wNumberingTab;            /* Space bet FirstIndent and 1st-line text*/
  714.     WORD    wBorderSpace;            /* Space between border and text (twips)*/
  715.     WORD    wBorderWidth;            /* Border pen width (twips)                */
  716.     WORD    wBorders;                /* Byte 0: bits specify which borders    */
  717.                                     /* Nibble 2: border style, 3: color index*/
  718. };
  719.  
  720. #else    /* regular C-style    */
  721.  
  722. typedef struct _paraformat2
  723. {
  724.     UINT    cbSize;
  725.     _WPAD    _wPad1;
  726.     DWORD    dwMask;
  727.     WORD    wNumbering;
  728.     WORD    wReserved;
  729.     LONG    dxStartIndent;
  730.     LONG    dxRightIndent;
  731.     LONG    dxOffset;
  732.     WORD    wAlignment;
  733.     SHORT    cTabCount;
  734.     LONG    rgxTabs[MAX_TAB_STOPS];
  735.      LONG    dySpaceBefore;            /* Vertical spacing before para            */
  736.     LONG    dySpaceAfter;            /* Vertical spacing after para            */
  737.     LONG    dyLineSpacing;            /* Line spacing depending on Rule        */
  738.     SHORT    sStyle;                    /* Style handle                            */
  739.     BYTE    bLineSpacingRule;        /* Rule for line spacing (see tom.doc)    */
  740.     BYTE    bCRC;                    /* Reserved for CRC for rapid searching    */
  741.     WORD    wShadingWeight;            /* Shading in hundredths of a per cent    */
  742.     WORD    wShadingStyle;            /* Nibble 0: style, 1: cfpat, 2: cbpat    */
  743.     WORD    wNumberingStart;        /* Starting value for numbering            */    
  744.     WORD    wNumberingStyle;        /* Alignment, roman/arabic, (), ), ., etc.*/
  745.     WORD    wNumberingTab;            /* Space bet 1st indent and 1st-line text*/
  746.     WORD    wBorderSpace;            /* Space between border and text (twips)*/
  747.     WORD    wBorderWidth;            /* Border pen width (twips)                */
  748.     WORD    wBorders;                /* Byte 0: bits specify which borders    */
  749.                                     /* Nibble 2: border style, 3: color index*/
  750. } PARAFORMAT2;
  751.  
  752. #endif /* C++    */
  753.  
  754. /* this is a hack to make PARAFORMAT code more readable.
  755.    it applies to the wReserved field in PARAFORMAT, which
  756.    in PARAFORMAT2 is now used. */
  757.  
  758. #define    wEffects            wReserved
  759.  
  760. /* PARAFORMAT 2.0 masks and effects */
  761.  
  762. #define PFM_SPACEBEFORE            0x00000040
  763. #define PFM_SPACEAFTER            0x00000080
  764. #define PFM_LINESPACING            0x00000100
  765. #define    PFM_STYLE                0x00000400
  766. #define PFM_BORDER                0x00000800    /* (*)    */
  767. #define PFM_SHADING                0x00001000    /* (*)    */
  768. #define PFM_NUMBERINGSTYLE        0x00002000    /* (*)    */
  769. #define PFM_NUMBERINGTAB        0x00004000    /* (*)    */
  770. #define PFM_NUMBERINGSTART        0x00008000    /* (*)    */
  771.  
  772. #define PFM_RTLPARA                0x00010000
  773. #define PFM_KEEP                0x00020000    /* (*)    */
  774. #define PFM_KEEPNEXT            0x00040000    /* (*)    */
  775. #define PFM_PAGEBREAKBEFORE        0x00080000    /* (*)    */
  776. #define PFM_NOLINENUMBER        0x00100000    /* (*)    */
  777. #define PFM_NOWIDOWCONTROL        0x00200000    /* (*)    */
  778. #define PFM_DONOTHYPHEN            0x00400000    /* (*)    */
  779. #define PFM_SIDEBYSIDE            0x00800000    /* (*)    */
  780.  
  781. #define PFM_TABLE                0xc0000000    /* (*)    */
  782.  
  783. /* Note: PARAFORMAT has no effects */
  784. #define PFM_EFFECTS  (PFM_RTLPARA | PFM_KEEP | PFM_KEEPNEXT | PFM_TABLE \
  785.                     | PFM_PAGEBREAKBEFORE | PFM_NOLINENUMBER  \
  786.                     | PFM_NOWIDOWCONTROL | PFM_DONOTHYPHEN | PFM_SIDEBYSIDE \
  787.                     | PFM_TABLE)
  788.  
  789. #define PFM_ALL2    (PFM_ALL | PFM_EFFECTS | PFM_SPACEBEFORE | PFM_SPACEAFTER \
  790.                     | PFM_LINESPACING | PFM_STYLE | PFM_SHADING | PFM_BORDER \
  791.                     | PFM_NUMBERINGTAB | PFM_NUMBERINGSTART | PFM_NUMBERINGSTYLE)
  792.  
  793. #define PFE_RTLPARA                (PFM_RTLPARA         >> 16)
  794. #define PFE_KEEP                (PFM_KEEP             >> 16)    /* (*)    */
  795. #define PFE_KEEPNEXT            (PFM_KEEPNEXT         >> 16)    /* (*)    */
  796. #define PFE_PAGEBREAKBEFORE        (PFM_PAGEBREAKBEFORE >> 16)    /* (*)    */
  797. #define PFE_NOLINENUMBER        (PFM_NOLINENUMBER     >> 16)    /* (*)    */
  798. #define PFE_NOWIDOWCONTROL        (PFM_NOWIDOWCONTROL     >> 16)    /* (*)    */
  799. #define PFE_DONOTHYPHEN            (PFM_DONOTHYPHEN      >> 16)    /* (*)    */
  800. #define PFE_SIDEBYSIDE            (PFM_SIDEBYSIDE         >> 16)    /* (*)    */
  801.  
  802. #define PFE_TABLEROW            0xc000        /* These 3 options are mutually    */
  803. #define PFE_TABLECELLEND        0x8000        /*  exclusive and each imply    */
  804. #define PFE_TABLECELL            0x4000        /*  that para is part of a table*/
  805.  
  806. /*
  807.  *    PARAFORMAT numbering options (values for wNumbering):
  808.  *
  809.  *        Numbering Type        Value    Meaning
  810.  *        tomNoNumbering          0        Turn off paragraph numbering
  811.  *        tomNumberAsLCLetter      1        a, b, c, ...
  812.  *        tomNumberAsUCLetter      2        A, B, C, ...
  813.  *        tomNumberAsLCRoman      3        i, ii, iii, ...
  814.  *        tomNumberAsUCRoman      4        I, II, III, ...
  815.  *        tomNumberAsSymbols      5        default is bullet
  816.  *        tomNumberAsNumber      6        0, 1, 2, ...
  817.  *        tomNumberAsSequence      7        tomNumberingStart is first Unicode to use
  818.  *
  819.  *    Other valid Unicode chars are Unicodes for bullets.
  820.  */
  821.  
  822.  
  823. #define    PFA_JUSTIFY            4    /* New paragraph-alignment option 2.0 (*) */
  824.  
  825.  
  826. /* notification structures */
  827.  
  828. #ifndef WM_NOTIFY
  829. #define WM_NOTIFY                0x004E
  830.  
  831. typedef struct _nmhdr
  832. {
  833.     HWND    hwndFrom;
  834.     _WPAD    _wPad1;
  835.     UINT    idFrom;
  836.     _WPAD    _wPad2;
  837.     UINT    code;
  838.     _WPAD    _wPad3;
  839. } NMHDR;
  840. #endif  /* !WM_NOTIFY */
  841.  
  842. typedef struct _msgfilter
  843. {
  844.     NMHDR    nmhdr;
  845.     UINT    msg;
  846.     _WPAD    _wPad1;
  847.     WPARAM    wParam;
  848.     _WPAD    _wPad2;
  849.     LPARAM    lParam;
  850. } MSGFILTER;
  851.  
  852. typedef struct _reqresize
  853. {
  854.     NMHDR nmhdr;
  855.     RECT rc;
  856. } REQRESIZE;
  857.  
  858. typedef struct _selchange
  859. {
  860.     NMHDR nmhdr;
  861.     CHARRANGE chrg;
  862.     WORD seltyp;
  863. } SELCHANGE;
  864.  
  865. #define SEL_EMPTY        0x0000
  866. #define SEL_TEXT        0x0001
  867. #define SEL_OBJECT        0x0002
  868. #define SEL_MULTICHAR    0x0004
  869. #define SEL_MULTIOBJECT    0x0008
  870.  
  871. /* used with IRichEditOleCallback::GetContextMenu, this flag will be
  872.    passed as a "selection type".  It indicates that a context menu for
  873.    a right-mouse drag drop should be generated.  The IOleObject parameter
  874.    will really be the IDataObject for the drop
  875.  */
  876. #define GCM_RIGHTMOUSEDROP  0x8000
  877.  
  878. typedef struct _endropfiles
  879. {
  880.     NMHDR nmhdr;
  881.     HANDLE hDrop;
  882.     LONG cp;
  883.     BOOL fProtected;
  884. } ENDROPFILES;
  885.  
  886. typedef struct _enprotected
  887. {
  888.     NMHDR nmhdr;
  889.     UINT msg;
  890.     _WPAD    _wPad1;
  891.     WPARAM wParam;
  892.     _WPAD    _wPad2;
  893.     LPARAM lParam;
  894.     CHARRANGE chrg;
  895. } ENPROTECTED;
  896.  
  897. typedef struct _ensaveclipboard
  898. {
  899.     NMHDR nmhdr;
  900.     LONG cObjectCount;
  901.     LONG cch;
  902. } ENSAVECLIPBOARD;
  903.  
  904. #ifndef MACPORT
  905. typedef struct _enoleopfailed
  906. {
  907.     NMHDR nmhdr;
  908.     LONG iob;
  909.     LONG lOper;
  910.     HRESULT hr;
  911. } ENOLEOPFAILED;
  912. #endif
  913.  
  914. #define    OLEOP_DOVERB    1
  915.  
  916. typedef struct _objectpositions
  917. {
  918.     NMHDR nmhdr;
  919.     LONG cObjectCount;
  920.     LONG *pcpPositions;
  921. } OBJECTPOSITIONS;
  922.  
  923. typedef struct _enlink
  924. {
  925.     NMHDR nmhdr;
  926.     UINT msg;
  927.     _WPAD   _wPad1;
  928.     WPARAM wParam;
  929.     _WPAD   _wPad2;
  930.     LPARAM lParam;
  931.     CHARRANGE chrg;
  932. } ENLINK;
  933.  
  934. /* PenWin specific */
  935. typedef struct _encorrecttext
  936. {
  937.     NMHDR nmhdr;
  938.     CHARRANGE chrg;
  939.     WORD seltyp;
  940. } ENCORRECTTEXT;
  941.  
  942. /* Far East specific */
  943. typedef struct _punctuation
  944. {
  945.     UINT    iSize;
  946.     LPSTR    szPunctuation;
  947. } PUNCTUATION;
  948.  
  949. /* Far East specific */
  950. typedef struct _compcolor
  951. {
  952.     COLORREF crText;
  953.     COLORREF crBackground;
  954.     DWORD dwEffects;
  955. }COMPCOLOR;
  956.  
  957.  
  958. /* clipboard formats - use as parameter to RegisterClipboardFormat() */
  959. #define CF_RTF             TEXT("Rich Text Format")
  960. #define CF_RTFNOOBJS     TEXT("Rich Text Format Without Objects")
  961. #define CF_RETEXTOBJ     TEXT("RichEdit Text and Objects")
  962.  
  963. /* Paste Special */
  964. typedef struct _repastespecial
  965. {
  966.     DWORD    dwAspect;
  967.     DWORD    dwParam;
  968. } REPASTESPECIAL;
  969.  
  970. /*    UndoName info */
  971. typedef enum _undonameid
  972. {
  973.     UID_UNKNOWN     = 0,
  974.     UID_TYPING        = 1,
  975.     UID_DELETE         = 2,
  976.     UID_DRAGDROP    = 3,
  977.     UID_CUT            = 4,
  978.     UID_PASTE        = 5
  979. } UNDONAMEID;
  980.  
  981. /* flags for the GETEXTEX data structure */
  982. #define GT_DEFAULT        0
  983. #define GT_USECRLF        1
  984.  
  985. /* EM_GETTEXTEX info; this struct is passed in the wparam of the message */
  986. typedef struct _gettextex
  987. {
  988.     DWORD    cb;                /* count of bytes in the string                */
  989.     DWORD    flags;            /* flags (see the GT_XXX defines            */
  990.     UINT    codepage;        /* code page for translation (CP_ACP for default,
  991.                                1200 for Unicode                            */
  992.     LPCSTR    lpDefaultChar;    /* replacement for unmappable chars            */
  993.     LPBOOL    lpUsedDefChar;    /* pointer to flag set when def char used    */
  994. } GETTEXTEX;
  995.  
  996. /* flags for the GETTEXTLENGTHEX data structure                            */
  997. #define GTL_DEFAULT        0    /* do the default (return # of chars)        */
  998. #define GTL_USECRLF        1    /* compute answer using CRLFs for paragraphs*/
  999. #define GTL_PRECISE        2    /* compute a precise answer                    */
  1000. #define GTL_CLOSE        4    /* fast computation of a "close" answer        */
  1001. #define GTL_NUMCHARS    8    /* return the number of characters            */
  1002. #define GTL_NUMBYTES    16    /* return the number of _bytes_                */
  1003.  
  1004. /* EM_GETTEXTLENGTHEX info; this struct is passed in the wparam of the msg */
  1005. typedef struct _gettextlengthex
  1006. {
  1007.     DWORD    flags;            /* flags (see GTL_XXX defines)                */
  1008.     UINT    codepage;        /* code page for translation (CP_ACP for default,
  1009.                                1200 for Unicode                            */
  1010. } GETTEXTLENGTHEX;
  1011.     
  1012.     
  1013. /* UNICODE embedding character */
  1014. #ifndef WCH_EMBEDDING
  1015. #define WCH_EMBEDDING (WCHAR)0xFFFC
  1016. #endif /* WCH_EMBEDDING */
  1017.         
  1018.  
  1019. #undef _WPAD
  1020.  
  1021. #ifdef _WIN32
  1022.  
  1023. #include <poppack.h>
  1024.  
  1025. #elif !defined(RC_INVOKED)
  1026. #pragma pack()
  1027. #endif
  1028.  
  1029. #ifdef __cplusplus
  1030. }
  1031. #endif  /* __cplusplus */
  1032.  
  1033. #pragma option pop
  1034. #endif /* !_RICHEDIT_ */
  1035.